// src/api/annualleave-api.js
import axios from 'axios';

// 基础配置
const api = axios.create({
    baseURL: 'http://localhost:8082',
    timeout: 8000
});


// 年假申请API
export const submitAnnualLeave = async (params) => {
    const formData = new URLSearchParams();
    formData.append('employeeId', params.employeeId);
    formData.append('operator', params.operator);
    formData.append('startDate', params.startDate);
    formData.append('daysLeave', params.daysLeave);
    formData.append('remark', params.remark || ''); // 保证空值传递

    const response = await api.post('/leave/apply', formData, {
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    });
    return response.data;
}

// export const submitAnnualLeave = async (params) => {
//     const response = await api.post('/leave/apply', null,{ params:params });
//     return response.data;
// }